package com.dog.modules.iot.mq;

import com.dog.framework.core.constant.IotMqConstants;
import com.dog.modules.iot.mqtt.consumer.dispatcher.CmdProcessor;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Component;

/**
 * @description 本体消息的消费者
 * @since 2022/07/08 14:00
 */
@Slf4j
@Component
public class RobotMsgConsumer<T>  {
    @Autowired
    public CmdProcessor cmdProcessor;

    @RabbitListener(queues = IotMqConstants.CLEANING_ROBOT_MSG_QUEUE_0)
    public void receiveQueue0(String content, @Headers Channel channel, Message message) {
        cmdProcessor.dispatch(content);
    }

    @RabbitListener(queues = IotMqConstants.CLEANING_ROBOT_MSG_QUEUE_1)
    public void receiveQueue1(String content, @Headers Channel channel, Message message) {
        cmdProcessor.dispatch(content);
    }

    @RabbitListener(queues = IotMqConstants.CLEANING_ROBOT_MSG_QUEUE_2)
    public void receiveQueue2(String content, @Headers Channel channel, Message message) {
        cmdProcessor.dispatch(content);
    }

    @RabbitListener(queues = IotMqConstants.CLEANING_ROBOT_MSG_QUEUE_3)
    public void receiveQueue3(String content, @Headers Channel channel, Message message) {
        cmdProcessor.dispatch(content);
    }

    @RabbitListener(queues = IotMqConstants.CLEANING_ROBOT_MSG_QUEUE_4)
    public void receiveQueue4(String content, @Headers Channel channel, Message message) {
        cmdProcessor.dispatch(content);
    }

    @RabbitListener(queues = IotMqConstants.CLEANING_ROBOT_MSG_QUEUE_5)
    public void receiveQueue5(String content, @Headers Channel channel, Message message) {
        cmdProcessor.dispatch(content);
    }

    @RabbitListener(queues = IotMqConstants.CLEANING_ROBOT_MSG_QUEUE_6)
    public void receiveQueue6(String content, @Headers Channel channel, Message message) {
        cmdProcessor.dispatch(content);
    }

    @RabbitListener(queues = IotMqConstants.CLEANING_ROBOT_MSG_QUEUE_7)
    public void receiveQueue7(String content, @Headers Channel channel, Message message) {
        cmdProcessor.dispatch(content);
    }

    @RabbitListener(queues = IotMqConstants.CLEANING_ROBOT_MSG_QUEUE_8)
    public void receiveQueue8(String content, @Headers Channel channel, Message message) {
        cmdProcessor.dispatch(content);
    }

    @RabbitListener(queues = IotMqConstants.CLEANING_ROBOT_MSG_QUEUE_9)
    public void receiveQueue9(String content, @Headers Channel channel, Message message) {
        cmdProcessor.dispatch(content);
    }

}
